<template>
  <div v-if="items.length" class="channel">
    <div class="channel-content">
      <div v-for="(item,index) in items.slice(0,3)"
           :key="index"
           class="channel-content-item"
           @click="onClick(item)">
        <img :src="item.adv_image">
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'MallChannel',
    props: {
      items: Array
    },
    methods: {
      onClick (item) {
        this.$router.push({
          name: 'mallChannel',
          params: { topicId: item.adv_value }
        })
      }
    }
  }
</script>

<style lang="less" scoped>
  .channel {
    background: #fff;
    font-size: 0;
    padding: 10px;

    * {
      box-sizing: border-box;
    }

    .channel-content {
      display: flex;
      flex-wrap: wrap;
      position: relative;
      justify-content: space-between;

      .channel-content-item {
        width: 44%;

        &:nth-child(2), &:nth-child(3) {
          width: 53%;
          height: 77px;
        }

        &:nth-child(3) {
          position: absolute;
          right: 0;
          bottom: 0;
        }

        &:nth-child(1) {
          height: 165px;
        }

        img {
          flex-shrink: 0;
          border-radius: 5px;
          width: 100%;
          /*border: 1px solid red;*/
          height: 100%;
        }
      }
    }
  }
</style>
